<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="utf-8">

        <title>系统登录 - 渝人地盘</title>

        <meta name="description" content="渝人地盘-一个只卖便宜精品的平台">
        <meta name="author" content="渝人地盘">
        <meta name="robots" content="noindex, nofollow">

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

        <!-- Icons -->
        <!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
        <link rel="shortcut icon" href="img/favicon.png">
        <link rel="apple-touch-icon" href="img/icon57.png" sizes="57x57">
        <link rel="apple-touch-icon" href="img/icon72.png" sizes="72x72">
        <link rel="apple-touch-icon" href="img/icon76.png" sizes="76x76">
        <link rel="apple-touch-icon" href="img/icon114.png" sizes="114x114">
        <link rel="apple-touch-icon" href="img/icon120.png" sizes="120x120">
        <link rel="apple-touch-icon" href="img/icon144.png" sizes="144x144">
        <link rel="apple-touch-icon" href="img/icon152.png" sizes="152x152">
        <link rel="apple-touch-icon" href="img/icon180.png" sizes="180x180">
        <!-- END Icons -->

        <!-- Stylesheets -->
        <!-- Bootstrap is included in its original form, unaltered -->
        <link rel="stylesheet" href="css/bootstrap.min.css">

        <!-- Related styles of various icon packs and plugins -->
        <link rel="stylesheet" href="css/plugins.css">

        <!-- The main stylesheet of this template. All Bootstrap overwrites are defined in here -->
        <link rel="stylesheet" href="css/mainindex.css">

        <!-- Include a specific file here from css/themes/ folder to alter the default theme of the template -->

        <!-- The themes stylesheet of this template (for using specific theme color in individual elements - must included last) -->
        <link rel="stylesheet" href="css/themes/passion.css"> 
        <!-- END Stylesheets -->

        <!-- Modernizr (browser feature detection library) -->
        <script src="js/vendor/modernizr-3.3.1.min.js"></script>
        <style type="text/css">
       
        </style>
    </head>
    <body>
    <div th:insert="basePages/loading::loading"></div>
        <!-- Login Container -->
        <div id="login-container">
            <!-- Login Header -->
            <h1 class="h2 text-light text-center push-top-bottom animation-slideDown">
                <img src="img/rblogo_180r.png" width="45em"> <strong>渝人地盘</strong>
            </h1>
            <!-- END Login Header -->

            <!-- Login Block -->
            <div class="block animation-fadeInQuickInv" style="padding: 20px 20px 1px;background-color: rgba(255, 255, 255, 0.3);border-color: rgba(166, 93, 195, 0.3);color: #fff;">
                <!-- Login Title -->
                <div class="block-title" align="center">
                    <h2>用户操作界面</h2>
                </div>
                <!-- END Login Title -->
                <!-- Login Form -->
                <div class="order_details" >
					<ul>
						<li class="btn fortab prepaids checked"><i class="fa fa-check"></i> 用户登录</li>
						<li class="btn fortab prepaids2"><i class="fa fa-plus"></i> 注册用户</li>
						<!-- <li class="btn fortab prepaids3"><i class="fa fa-question"></i> 密码找回</li> -->
					</ul>
					</div>
                <form id="form-login" method="post" class="form-horizontal" style="margin-top: 28px;" onsubmit="return false;">
					<div class="tablelist showdomdiv showsss">

					<div id="user-login">
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input type="text" id="login-email" name="login-email" class="form-control" placeholder="您的用户名">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input type="text" id="login-password1" autocomplete="off" class="form-control" placeholder="您的密码">
                            <input type="hidden" id="login-password" name="login-password" >
                        </div>
                    </div>
                    <!-- <div align="center" style="margin-bottom:-35px;margin-top:-15px;">
                    <span id="showloginErr" style="display:none;font-size:0.5em;color:red;"></span>
                    </div> -->
                    <div class="form-group form-actions text-right" align="center">
                    <p id="showloginErr" style="display:none;font-size:0.5em;color:red;margin:1px 120px 3px 4px;">手机号码有误</p>
                        <button id="login_config" type="submit" class="btn btn-effect-ripple btn-sm btn-primary col-xs-8" style="margin: 0px 60px;background: -webkit-linear-gradient(top,rgb(41, 58, 120),rgb(222, 129, 92));border-color: rgba(166, 93, 195, 0.3);color: #fff;" onclick="login_form()">
                        <i class="fa fa-check"></i> 确认登录</button>
                    </div>
                    </div>
				</div>
				
				
				<div class="tablelist hidedomdiv showsss">
				<div id="user-register">
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input type="text" id="username" name="username" class="form-control" placeholder="您的账号">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input type="text" id="pass_register" class="form-control" placeholder="您的密码">
                        </div>
                    </div>
                    
       				<div class="form-group" align="center" style="color:#333;">
         					<select style="font-size:0.5em;background: rgb(222, 129, 92);" id="userrolechose">
        		    		<option  style="color:#333;">请选择角色</option>
							<option style="color:#333;" th:text="店铺老板"  th:value="20001"></option>
							<option style="color:#333;" th:text="店铺员工"  th:value="20002"></option>
							<option style="color:#333;" th:text="活动管理"  th:value="20003"></option>
							<option style="color:#333;" th:text="综合管理"  th:value="20004"></option>
                     		</select>
        			</div>
	                    			
	                 <div class="form-group">
                        <div class="col-xs-8" align="left">
                            <input type="text" id="userphone" name="userphone" class="form-control" placeholder="您的手机号">
                        </div>
                        <div class="col-xs-4" align="right">
                        	<p id="getCodeErr" style="display:none;font-size:0.1em;color:red;margin:1px 12px 3px 4px;">手机格式错误</p>
                            <button id="codeButton" onclick="getCode()" class="form-control" style="border-color: #f2f2f3;color: #77596c;">点击获取</button>
                        </div>
                    </div>
	                    			
       				<div class="form-group">
                        <div class="col-xs-12">
                            <input type="text" id="authcode" autocomplete="off" class="form-control" placeholder="您的验证码">
                        </div>
                    </div>
                    
                    <div class="form-group form-actions text-right" style="width:100%" align="center">
                    <!-- <p id="showErr" style="display:none;font-size:0.5em;color:red;"></p> -->
                    <p id="showErr" style="display:none;font-size:0.5em;color:red;margin:1px 88px 3px 4px;">手机号码有误</p>
                        <button id="submit_register" type="submit" class="btn btn-effect-ripple btn-sm btn-primary col-xs-8" style="margin: 0px 60px;background: -webkit-linear-gradient(top,rgb(41, 58, 120),rgb(222, 129, 92));border-color: rgba(166, 93, 195, 0.3);color: #fff;" onclick="register_from()">
                        <i class="fa fa-check"></i> 提交注册</button>
                    </div>
                    
                    </div>
				</div>
				
				
				<!-- <div class="tablelist hidedomdiv showsss">
				<div id="password-reback">
                    <div class="form-group">
                        <div class="col-xs-8" align="left">
                            <input type="text" id="reback-phone" name="reback-phone" class="form-control" placeholder="您的手机号">
                        </div>
                        <div class="col-xs-4" align="right">
                            <button class="form-control" onclick="rebackCode()" style="border-color: #f2f2f3;color: #77596c;">点击获取</button>
                        </div>
                        
                    </div>
                    <div class="form-group">
                        <div class="col-xs-12">
                            <input type="text" id="login-code" autocomplete="off" class="form-control" placeholder="您的验证码">
                        </div>
                    </div>
                    <div class="form-group form-actions text-right" style="width:100%" align="right">
                        <button type="submit" class="btn btn-effect-ripple btn-sm btn-primary col-xs-8" style="margin: 0px 60px;background: -webkit-linear-gradient(top,rgb(41, 58, 120),rgb(222, 129, 92));border-color: rgba(166, 93, 195, 0.3);color: #fff;" onclick="">
                        <i class="fa fa-check"></i>找回密码</button>
                    </div>
                    </div>
				</div> -->
				</form>
			</div>
                    <HR style="FILTER: progid:DXImageTransform.Microsoft.Shadow(color:#fff,direction:145,strength:20);color:rgb(133, 114, 154);width:100%;">
                

            <!-- Footer -->
            <footer class="text-muted text-center animation-pullUp">
            		<div style="width:300px;margin:0 auto; padding:20px 0;">
				 		<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=50010902000997" style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="img/icongov.png" style="float:left;"/><p style="float:left;height:15px;line-height:20px;margin: 0px 0px 0px 5px; color:#fff;">渝公网安备 50010902000997号</p></a>
				 	</div>
                        <div class="text-center">
                        <!-- <a href="https://api.kuaidi100.com/" target="_blank">快递100</a><br> -->
                            <small>&copy; <span id="year-copy">2020</span> <font color="#fff">渝人地盘公众号</font></small><br>
                        </div>
            </footer>
            <!-- END Footer -->
        </div>
        <!-- END Login Container -->

        <!-- jQuery, Bootstrap, jQuery plugins and Custom JS code -->
        <script src="js/vendor/jquery-2.2.4.min.js"></script>
        <script src="js/vendor/bootstrap.min.js"></script>
        <script src="js/plugins.js"></script>
        <script src="js/app.js"></script>
        <script src="js/md5.js"></script>

        <!-- Load and execute javascript code used only in this page -->
        <script src="js/pages/readyLogin.js"></script>
        <script>
        var login_form=function(button,id){
        	var acc=$("#login-email").val();
        	var pas=$("#login-password").val();
            $.ajax({
                url:"/login",
                type:"POST",
                data:{account:acc,password:hex_md5(pas)},
                dataType:'json',
                success:function (data) {
                    if(data.status==1){
                    	/* var sUserAgent = navigator.userAgent.toLowerCase();  
                        var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";  
                        var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";  
                        var bIsMidp = sUserAgent.match(/midp/i) == "midp";  
                        var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";  
                        var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";  
                        var bIsAndroid = sUserAgent.match(/android/i) == "android";  
                        var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
                        var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
                        if((bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) && (data.data.departmentName == "策划组" || data.data.roleLevel == "超级管理员" || data.data.roleLevel == "高级")){
                        	window.location.href="xmtdz";
                        }else{
                        	window.location.href="backPageCenter";
                        } */
                        window.location.href="backPageCenter";
                    }else{
                    	infoToClose=setInterval("removeErrorInfo('showloginErr')", 2500);
                		$("#login_config").attr('disabled',true);
                		$("#showloginErr").html(data.text).show();
                		return;
                    }

                },
                error:function (e) {
                    console.log(e);
                }
                ,timeout:function (e) {
                    console.log(e);
                }
            });
        };
        var infoToClose="";
        var register_from=function(){
        	var passregister=$("#pass_register").val();
        	var rolecode=$("#userrolechose").val();
        	var userphone=$("#userphone").val();
        	var authcode=$("#authcode").val();
        	var username=$("#username").val();
        	if($.trim(userphone).length==0||$.trim(rolecode).length==0||$.trim(authcode).length==0||$.trim(username).length==0||$.trim(rolecode)=="请选择角色"){
        		infoToClose2=setInterval("removeSubmitTime('showErr')", 2500);
        		$("#submit_register").attr('disabled',true);
        		$("#showErr").html("请完善注册信息").show();
        		return;
        	}
        	$.ajax({
            url:"/free/consumerRegister",
            type:"POST",
            data:{roleCode:rolecode,password:hex_md5(passregister),phone:userphone,account:username,authcode:authcode},
            dataType:'json',
            success:function (data) {
                    if(data.status==1){
                    	alert(data.text);
                        window.location.href="/i.do"; 
                    }else{
                    	removeErrorInfo('showErr');
                    	infoToClose2=setInterval("removeSubmitTime('showErr')", 2500);
                		$("#login_config").attr('disabled',true);
                		$("#showErr").html(data.text).show();
                    }

                },
                error:function (e) {
                    console.log(e);
                }
                ,timeout:function (e) {
                    console.log(e);
                }
            });
        };

    var s=59;
   	var getCode=function(){
   		$("#codeButton").attr('disabled',true);
   		var phoneCheck="^1[0-9]{10}$";
   		var userphone=$("#userphone").val();
   		var b = RegExp(phoneCheck).test(userphone);
   		if(!b){
   			infoToClose=setInterval("removeErrorInfo('getCodeErr')", 2500);
   			$("#codeButton").attr('disabled',true);
    		$("#getCodeErr").show();
    		return
   		}
    		$.ajax({
            url:"/free/checkAuthCode",
            type:"POST",
            data:{phone:userphone},
            dataType:'json',
            success:function (data) {
                    if(data.status==1){
                			s=59;
                			showCodeTime();
                    }else{
                    	infoToClose=setInterval("removeErrorInfo('getCodeErr')", 2500);
                		$("#getCodeErr").text(data.text).show();
                    }

                },
                error:function (e) {
                    console.log(e);
                }
                ,timeout:function (e) {
                    console.log(e);
                }
            }); 
   	};
   	var infoToClose1="";
   	var showCodeTime=function(){
		infoToClose1=setInterval("showCodeButton("+s+")",1000);
   	};
   	var showCodeButton=function(){
   		clearInterval(infoToClose1);
   		$("#codeButton").css('color','red');
		$("#codeButton").text(s);
		if(s>0){
			s=s-1;
			showCodeTime();
			return;
		}else{
			$("#codeButton").css('color','#333');
			$("#codeButton").text("点击获取");
			$("#codeButton").attr('disabled',false);
			return;
		}
   	};
   	var removeSubmitTime=function(name){
   		$("#"+name).hide();
   		$("#submit_register").attr('disabled',false);
		 clearInterval(infoToClose);
		 return;
   	};
    var removeErrorInfo=function(name){
    	$("#"+name).hide();
    	$("#submit_register").attr('disabled',false);
    	$("#login_config").attr('disabled',false);
    	$("#codeButton").attr('disabled',false);
		 clearInterval(infoToClose);
		 return;
	 };
        </script>
        
        <script>
        var str=""//存储表单真实密码
         $("#login-password1").keyup(function(){
            value=$(this).val()//获取表单密码
            if(value.length>=str.length){//当密码长度增加时由于前面的已经变成星号，所以截取后面输入的字符追加到str中
               str+=value.substr(str.length,value.length-str.length)    
            }
            else{//当密码长度减小时，判断减小后的长度，然后从真实密码中截取
              str=str.substr(0,value.length)
            }
             $(this).val(value.replace(/./g,"*"))//变星星喽
             $("#login-password").val(str);
         })
         
    </script>
    <script type="text/javascript">
		$(document).ready(function() {
			$(".tablelist:eq(" + $(".prepaids").index() + ")").show();
			$(".tablelist:eq(" + $(".prepaids").index() + ")").siblings().hide();
		// 改为鼠标移上的事件只需把click改为mousemove
		$(".fortab").click(function() {
		var number = $(".fortab").index(this);
		$(this).addClass("checked");
		$(this).siblings().removeClass("checked");
		$(".tablelist:eq(" + number + ")").show();
		$(".tablelist:eq(" + number + ")").siblings().hide();
		});
		});
		</script>
    </body>
</html>